import {Subject} from 'rxjs/Subject';
import {GrowlMsg} from '../model/share.model';

export class PubSubEvent extends Subject<any> {
  constructor() {
    super();
  }
  emit(value) { super.next(value); }
}

export class MsgChangeEvent extends PubSubEvent {
  constructor() {
    super();
  }
  add(value) {
    this.emit(value);
  }
  info(msg) {
    this.emit(new GrowlMsg('info', '提示', msg));
  }
  error(msg) {
    this.emit(new GrowlMsg('error', '错误', msg));
  }
  success(msg) {
    this.emit(new GrowlMsg('info', '操作', msg));
  }
}
export class MenuClickEvent extends PubSubEvent {
  constructor() {
    super();
  }
  menuClick(value: any) {
    this.emit(value);
  }
}

